<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/commons/taglibs.jsp" %>
<!DOCTYPE HTML>
<html>
  <head>
  <title>wxPublicAccount列表</title>
  </head>
  <body>
 	<a class="btn-link pull-right"  href="${ctx}/wx3p/toAuth">添加公众号</a>
 	<table class="table table-striped table-bordered table-hover" id="wxPublicAccountList">
 	<thead><tr>
		 	<td>授权时间</td>
		 	<td>昵称</td>
		 	<td>头像</td>
		 	<td>类型</td>
		 	<td>认证类型</td>
		 	<td>名称</td>
		 	<td>微信号</td>
		 	<td>二维码</td>
 			<td>操作</td>
 	</tr>
 	</thead>
 	</table>
 	<script type="text/javascript" src="${ctx}/static/js/DataTables/js/jquery.dataTables.js"></script>
 	<script type="text/javascript" src="${ctx}/static/js/DataTables/js/jquery.dataTables_bootstrap.js"></script>
 	<script type="text/javascript" src="${ctx}/static/js/DataTables/js/dataTables.defaults.js"></script>
 	<link href="${ctx}/static/js/DataTables/css/dataTables.bootstrap.css" type="text/css" rel="stylesheet" />
 	<script type="text/javascript">
 		var table=null;
		$(function(){
			table=$("#wxPublicAccountList").DataTable({
			      "sAjaxSource": "${ctx}/wx3p/pageList",
			      "aoColumns": [
					 	 { "mData": "authorizerTime","sDefaultContent" : ""},
					 	 { "mData": "nickName","sDefaultContent" : ""},
					 	 { "mData": "headImg","sDefaultContent" : ""},
					 	 { "mData": "serviceTypeInfo","sDefaultContent" : ""},
					 	 { "mData": "verifyTypeInfo","sDefaultContent" : ""},
					 	 { "mData": "userName","sDefaultContent" : ""},
					 	 { "mData": "alias","sDefaultContent" : ""},
					 	 { "mData": "qrcodeUrl","sDefaultContent" : ""},
			        { "mData": "appid",
			        	"mRender":function(data){
			        	var opt='<a href="${ctx}/wx3p/manage/'+data+'/user/list">用户</a>'
								+'<a href="${ctx}/wx3p/manage/'+data+'/qrCord/list">扫码</a>'
				        		+'<a class="btn btn-small" onclick="del(\'' + data + '\')">删除</a>';
				        	return opt;
	                   }
	                }
			      ]
			    });
		});
    	function del(id){
      		layer.confirm('确定删除?', function(){
      			$.post("${ctx}/wx3p/del",{appid:id},function(d){
      				table.page(table.page()).draw(false);
      				layer.msg(d.msg);
    	  			},"json");
      			});
      	  	}
 	</script>
  </body>
</html>
